# Replication Archive for 
# Alexander Coppock, Emily Ekins and David Kirby (2018), 
# "The Long-lasting Effects of Newspaper Op-Eds on Public Opinion",
# Quarterly Journal of Political Science: Vol. 13: No. 1, pp 59-87.

rm(list = ls())

# Uncomment to install
# install.packages(c("tidyverse""))

library(tidyverse)

# Set working directory to replication archive

load("mturk_opeds_cleaned.rdata")
load("elite_opeds_cleaned.rdata")
load("dv_df.rdata")
source("opeds_source.R")

mean(mturk_opeds$time_spent_reading, na.rm = TRUE) / 60
mean(elite_opeds$time_spent_reading, na.rm = TRUE) / 60

mturk_opeds %>%
  group_by(Z) %>%
  summarise(average_time = mean(time_spent_reading, na.rm = TRUE, trim = 0.01)/60)

elite_opeds %>%
  group_by(Z) %>%
  summarise(average_time = mean(time_spent_reading, na.rm = TRUE, trim = 0.01)/60)


mturk_opeds %>%
  group_by(Z) %>%
  summarise(average_time = mean(time_spent_reading, na.rm = TRUE, trim = 0.01))

elite_opeds %>%
  group_by(Z) %>%
  summarise(average_time = mean(time_spent_reading, na.rm = TRUE, trim = 0.01))

160.4120 - 134.00352
232.0353 - 186.43233
